<template>
	<view class="moneyDetail">
		<view class="container" style="height: 1px;"></view>
		<view class="container">
			<view class="container flex-xy bgF " v-for="(items, i) in orderList" v-bind:key="i">
				<view class="w95 flex-spc-x  pt10 pb10">
					<view class="w50 "><text class="fs34">{{items.money}}</text></view>
					<view class="w50 tar">
						<view class="fs24 co666 pb20">{{items.createTime}}</view>
						<view style="color: #1762f2;" class="fs26" v-if="!!items.type">
							<text v-if="items.type==1" :class="items.delete==true ?'delete' :'' ">消费幸运币</text>
							<text v-if="items.type==2" :class="items.delete==true ?'delete' :'' ">消费矿币</text>
							<text v-if="items.type==3" >算力变更</text>
						</view>
					</view>
				</view>
				<view v-if="!!items.remark" class="w95 flex-xy   pb10" >
					<view class="w95 mb10" style="height: 1px;background: #f3f3f3;"></view>
					<view class="w95 tal" >备注：{{items.remark}}</view>
					<!-- :class="items.delete==true ?'delete' :'' " -->
				</view>
				<view class="w100" style="height:2px;background: #f3f3f3;"></view>
			</view>
				<view class="container  mt20 mb20" style="background: #f3f3f3;"><u-divider color="#CCC" bg-color="#f3f3f3">~到底了,宝贝~</u-divider></view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			orderList: [], //订单列表
			index: null, //当前点击立即购买时候的购买商品下标
			pageSize: 20, //每页数量
			pageNum: 1 //页码
		};
	},
	methods: {
		// GET/mobileUser/detail/list查询用户资金列表
		getOrderList() {
			var postObj = { url: '/mobileUser/detail/list', data: { pageNum: this.pageNum, pageSize: this.pageSize,userId: uni.getStorageSync('y-userId'), } };
			this.getRequest(postObj)
				.then(res => {
					// console.log('res查询用户资金列表 ', res);
					if (res.data.code == 200) {
						// items.delete
						if(res.data.rows.length>0){
							res.data.rows.forEach((items,i)=>{
								var money = Number(items.money)
								if (money>0) items.delete = false  //正
								if (money<0) items.delete = true  //负
							})
						}
						this.orderList = [...this.orderList, ...res.data.rows];
					}
				})
				.catch(err => {
					// console.log('err查询用户资金列表 ', err);
				});
		}
	},
	// 触底事件
	onReachBottom() {
		this.pageNum += 1;
		this.getOrderList();
	},
	onShow() {
		this.pageNum = 1; //页码
		this.orderList=[]
		this.getOrderList(); //查询订单列表
	}
};
</script>

<style lang="less" scoped>
	.delete{
		color: red;
	}
</style>
